/* 
 * File:   BlockingQueue.h
 * Author: lucia
 *
 * Created on 31 de octubre de 2014, 16:44
 */

#ifndef BLOCKINGQUEUE_H
#define	BLOCKINGQUEUE_H

#include <queue>
#include <mutex>
#include <condition_variable>

class BlockingQueue {
private:
    mutable std::mutex mtx;
    std::condition_variable cv;
    std::queue<void*> queue;
    
//    bool pushing;
    
public:
    BlockingQueue();
    
    void push(void* data);
    void* pop();
    
    void* waitAndPop();
    bool tryPop(void* data);
    
    bool empty();
    int size();
    
    virtual ~BlockingQueue();

};

#endif	/* BLOCKINGQUEUE_H */

